<!DOCTYPE html>
<html>
<head>
	{include file="common_header" /}
	{include file="common_top" /}
</head>
<body>

  <div class="layui-fluid">
    <div class="layui-card">
      <div class="layui-card-header">添加分类</div>
      <div class="layui-card-body" style="padding: 15px;">
        <form class="layui-form" action="" lay-filter="component-form-group">

		  <div class="layui-form-item">
            <label class="layui-form-label">站点名称</label>
            <div class="layui-input-block">
              <input type="text" name="title" id="title"   placeholder="站点名称" class="layui-input" value="{$info['sub_webtitle']}">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">站点域名</label>
            <div class="layui-input-block">
              <input type="text" name="domain" id="domain"   placeholder="站点域名" class="layui-input" value="{$info['sub_domain']}">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">客户QQ</label>
            <div class="layui-input-block">
              <input type="text" name="sub_qq1" id="sub_qq1"   placeholder="客户QQ" value="{$info['sub_qq1']}" class="layui-input">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">财务QQ</label>
            <div class="layui-input-block">
              <input type="text" name="sub_qq2" id="sub_qq2"   placeholder="财务QQ" value="{$info['sub_qq2']}" class="layui-input">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">充值比例</label>
            <div class="layui-input-block">
              <input type="text" name="credit" id="credit"   placeholder="充值比例" class="layui-input" value="{$info['sub_credit']}">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">快捷金额</label>
            <div class="layui-input-block">
              <input type="text" name="fastmoney" id="fastmoney"   placeholder="快捷金额" class="layui-input" value="{$info['sub_fastmoney']}">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">直推拥金</label>
            <div class="layui-input-block">
              <input type="text" name="commission_one" id="commission_one"   placeholder="直推拥金" class="layui-input" value="{$info['sub_commission_one']}">
            </div>
          </div>
		  
		  <!--<div class="layui-form-item">
            <label class="layui-form-label">二级拥金</label>
            <div class="layui-input-block">
              <input type="text" name="commission_two" id="commission_two"   placeholder="二级拥金" class="layui-input" value="{$info['sub_commission_two']}">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">三级拥金</label>
            <div class="layui-input-block">
              <input type="text" name="commission_three" id="commission_three"   placeholder="三级拥金" class="layui-input" value="{$info['sub_commission_three']}">
            </div>
          </div>-->
		  

          <div class="layui-form-item">
            <label class="layui-form-label">站点状态</label>
            <div class="layui-input-block">
              <input type="radio" name="status" value="1" title="启用" {if $info['sub_status']==1}checked=""{/if}>
              <input type="radio" name="status" value="2" title="禁用" {if $info['sub_status']==2}checked=""{/if}>
            </div>
          </div>   
		  


   
          <div class="layui-form-item layui-layout-admin">
            <div class="layui-input-block">
              <div class="layui-footer" style="left: 0;">
                <div class="layui-btn sub">立即提交</div>
                <button type="reset" class="layui-btn layui-btn-primary ">重置</button>
              </div>
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>
{include file="common_footer" /} 
<script>


$(".sub").click(function(){
	//if(!$(".btn").hasClass("sub")){return false;}
	
	var title        = $("#title").val();
	var domain      = $("#domain").val();
	var status       = $("input[name='status']:checked").val();
	
	var credit      = $("#credit").val();
	var fastmoney      = $("#fastmoney").val();
	var commission_one      = $("#commission_one").val();
	var commission_two      = $("#commission_two").val();
	var commission_three      = $("#commission_three").val();
	
	var sub_qq1      = $("#sub_qq1").val();
	var sub_qq2      = $("#sub_qq2").val();
	

	if(title == ""){
		show_error("站点名称不能为空");
		return false
	}
	
	$.ajax({
		type:"POST",
		url:"{:url('substation/edit')}",
		dataType:"json",
		data:{
			id:{$info['sub_id']},
			sub_qq1:sub_qq1,
			sub_qq2:sub_qq2,
			title:title,
			status:status,
			domain:domain,
			credit:credit,
			fastmoney:fastmoney,
			commission_one:commission_one,
			commission_two:commission_two,
			commission_three:commission_three,
		},
		success:function(res){
			if(res.status == "success"){
				show_toast_callurl(res.data,"{:url('substation/index')}","success");
			}else{
				show_error(res.data);
			}
		},
		error:function(jqXHR){
			console.log("Error: "+jqXHR.status);
		},
	});
	
});
</script>
</body>
</html>